<template>
    <basic-container>
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="招商银行基础" name="A">
                <div style="width:50%;margin-top: 10px;">
                    <avue-form ref="form" v-model="objA" :option="optionA"  @submit="submitA">
                    </avue-form>
                </div>
            </el-tab-pane>
        </el-tabs>
    </basic-container>
</template>

<script>
    import {
        getZhPay,
        setZhPay
    } from "../../api/base/sysSet/zhPaySet";

    export default {
        data() {
            return {
                activeName: 'A',
                objA:{},
                optionA:{
                    emptyBtn:false,
                    labelWidth:'200',
                    labelPosition:'left',
                    column: [{
                        label: "门店openId",
                        prop: "zhpayOpenId",
                        span: 24,
                        display:false,
                        rules: [{
                            required: true,
                            message: "门店openId",
                            trigger: "blur"
                        }]
                    },{
                        label: "门店openKey",
                        prop: "zhpayOpenKey",
                        span: 24,
                        display:false,
                        rules: [{
                            required: true,
                            message: "门店openKey",
                            trigger: "blur"
                        }]
                    },{
                        label: "主管密码：用于退款",
                        prop: "zhpayShopPass",
                        span: 24,
                        rules: [{
                            required: true,
                            message: "主管密码：用于退款",
                            trigger: "blur"
                        }]
                    },{
                        label: "小程序AppId",
                        prop: "zhpayAppId",
                        span: 24,
                        rules: [{
                            required: true,
                            message: "小程序AppId",
                            trigger: "blur"
                        }]
                    },{
                        label: "支付地址",
                        prop: "zhpayPayUrl",
                        span: 24,
                        rules: [{
                            required: true,
                            message: "支付地址",
                            trigger: "blur"
                        }]
                    },{
                        label: "招行通知地址",
                        prop: "zhpayNotifyUrl",
                        span: 24,
                        rules: [{
                            required: true,
                            message: "招行通知地址",
                            trigger: "blur"
                        }]
                    },{
                        label: "招行支付标签",
                        prop: "zhpayXcxTag",
                        span: 24,
                        rules: [{
                            required: true,
                            message: "招行支付标签",
                            trigger: "blur"
                        }]
                    }]
                }
            }
        },
        //页面初始化
        created(){
            this.getData()
        },
        methods: {
            getData(){
                getZhPay().then(res=>{
                    if(res.data.code==200){
                        let obj=res.data.data
                        // 基础
                        this.objA.zhpayOpenId=obj.zhpayOpenId
                        this.objA.zhpayOpenKey=obj.zhpayOpenKey
                        this.objA.zhpayShopPass=obj.zhpayShopPass
                        this.objA.zhpayAppId=obj.zhpayAppId
                        this.objA.zhpayPayUrl=obj.zhpayPayUrl
                        this.objA.zhpayNotifyUrl=obj.zhpayNotifyUrl
                        this.objA.zhpayXcxTag=obj.zhpayXcxTag
                    }
                })

            },
            handleClick(tab, event) {
                console.log(tab, event);
            },
            submitA (form,done) {
                setZhPay(this.objA).then(res=>{
                    done()
                    this.$message({
                        message:'提交成功',
                        type:'success'
                    })
                    this.activeName='A'
                    this.getData()
                })
            }
        }
    };
</script>
<style>
    h5{
        color: darkred;
        font-weight: bold;
    }
    p{
        line-height: 30px;
    }

</style>